#pragma once

#ifndef T_TASK_POOL_FUNC_H
#define T_TASK_POOL_FUNC_H

#include <functional>

typedef std::function<void()> TTask;

struct TTaskClosureInterface
{
    TTaskClosureInterface() { }
    virtual ~TTaskClosureInterface() {}
    virtual void invoke(void) = 0;
};

// 任务闭包基类，将任务相关的信息打包到这个简单的结构
struct TTaskClosure : public TTaskClosureInterface
{
    TTaskClosure(TTask const& f): functor(f){}
    virtual ~TTaskClosure() {}
    virtual void invoke(void) { functor(); }
private:
    TTask functor;
};
#endif
